import io
import pickle
import sys

F = open(r'vocab.pkl','rb')
content = pickle.load(F)
with open('vocab.txt','w') as x:
    sys.stdout = x
    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf8')  # 改变标准输出的默认编码
    print(content)